import Vue from 'vue'
import Vuex from 'vuex'

import modules from './modules'

Vue.use(Vuex)

export default new Vuex.Store({
  modules,
  state: {
    active: 0,
    jurisdiction: 0,  // 记录当前校验文件的开放权限： 1：开放上学期 2：开放下学期 3：全开放
    homeindex: true,
    active_grade: 1,  // 记录超级游戏包当前选择的学期： 1：一级上 2：一级下 3：二级上......
    supergame2ar: false, // 标志是否由超级游戏包跳转到ar页
    active_month: 3, // 记录超级游戏包当前选择的月份
    active_week: 1 // 记录超级游戏包当前选择的周数
  },
  // strict: process.env.NODE_ENV !== 'production',
  mutations: {
    success (state) {
      state.active = 1
    },
    failed (state) {
      state.active = 0
    },
    up (state) {
      state.jurisdiction = 1
    },
    down (state) {
      state.jurisdiction = 2
    },
    all (state) {
      state.jurisdiction = 3
    },
    change_homeindex (state) {
      state.homeindex = !state.homeindex
    },
    // 记录超级游戏包当前选择的学期
    change_active_grade (state, index) {
      state.active_grade = index
    },
    to_ar_flag (state, obj) {
      state.supergame2ar = !state.supergame2ar
      state.active_month = obj.vuexMonth
      state.active_week = obj.vuexWeek
    }
  }
})
